home *** CD-ROM | disk | FTP | other *** search
/ isnet Internet / Isnet Internet CD.iso / prog / chat / 12 / 12.exe / SYSTEM / IDENTFRS.ALS < prev    next >
Encoding:
Text File  |  2000-03-04  |  21.1 KB  |  627 lines

  1. # return #$1
  2. a.act {
  3.   if ($readini -n $td(msg.txt) $a.nknum($1) act [ $+ [ $2 ] ] == yes) return $colnum(Action) $+ $3-
  4.   else return $3-
  5. }
  6. a.addy return $readini -n $td(msg.txt) $1 addy
  7. a.date return $asctime( [ $readini -n $td(msg.txt) $1 ldate ] ,dd-mm-yy @ h:nntt)
  8. a.dte return $asctime( [ $readini -n $td(msg.txt) $1 d [ $+ [ $2 ] ] ] ,dd-mm-yy @ h:nntt)
  9. a.f return $remove($1-,/,|)
  10. a.lastaddy return ( $+ $readini -n $td(msg.txt) messages lastrecaddy $+ )
  11. a.lastdate return $asctime( [ $readini -n $td(msg.txt) messages lastrecdate ] ,dd-mm-yy @ h:nntt)
  12. a.lastmsg return $readini -n $td(msg.txt) messages lastrecmsg
  13. a.lastnick return $readini -n $td(msg.txt) messages lastrecnick
  14. ab return [[ $+ $1- $+ ]]
  15. alof {
  16.   if ($1 >= 1073741824) return $round($calc($1 / 1073741824),2) $+ gb
  17.   elseif ($1 >= 1048576) return $round($calc($1 / 1048576),2) $+ mb
  18.   elseif ($1 >= 1024) return $round($calc($1 / 1024),2) $+ kb
  19.   elseif ($1 isnum) return $1 $+ b
  20.   else return 0b
  21. }
  22. a.msg return $readini -n $td(msg.txt) $1 m [ $+ [ $2 ] ]
  23. a.msgno {
  24.   if ($readini -n $td(msg.txt) $1 msgno isnum) return $readini -n $td(msg.txt) $1 msgno
  25.   else return 0
  26. }
  27. a.nknum return $readini -n $td(msg.txt) messages nicknumber [ $+ [ $1 ] ]
  28. a.numnk return $readini -n $td(msg.txt) messages totalnumnk
  29. a.numsg {
  30.   set %tmp.a.numsg $readini -n $td(msg.txt) messages totalnumsg
  31.   if (%tmp.a.numsg isnum) return %tmp.a.numsg
  32.   else return 0
  33. }
  34. ac return  $+ %c4 $+ $iif($1 != $null,$1-) $+ $iif($1 != $null,)
  35. adn return %dir $+ \addon\ $+ $1
  36. adnl return $read -nl $+ $1 $tp(addonld.txt)
  37. apd return %dir $+ \addon\pics\ $+ $1
  38. ascode {
  39.   set %i.ascode 0
  40.   set %j.ascode 0
  41.   :start
  42.   inc %i.ascode
  43.   set %tmp.ascode $mid($3-,%i.ascode,1)
  44.   if (%tmp.ascode != $null) {
  45.     if (%tmp.ascode == $chr(32)) goto start
  46.     elseif (($asc(%tmp.ascode) >= $1) && ($asc(%tmp.ascode) <= $2)) inc %j.ascode
  47.     goto start
  48.   }
  49.   return $mpy($div(%j.ascode,$len($3-)),100)
  50. }
  51. atd return %dir $+ \addon\text\ $+ $1
  52. atime return $asctime(h:nntt)
  53. asc-time {
  54.   set -u %tmp.asc-time ddd, mmm dd yyyy
  55.   return $asctime($1,%tmp.asc-time) at $asctime($1,h:nntt)
  56. }
  57. atp return %dir $+ \addon\temp\ $+ $1
  58. avar return $readini -n $adn($1) Addon $2
  59. autoawymsg {
  60.   if (%autousedef == on) return  $+ %iver - autoaway after  $+ $div(%idle,60) $+ m
  61.   else return %defaulta
  62. }
  63. avconv {
  64.   unset %tmp.avconv
  65.   set %j.avconv 0
  66.   set %i.avconv 0
  67.   :start
  68.   inc %i.avconv
  69.   if ($gettok($1-,%i.avconv,32)) {
  70.     if ($exists($adn($gettok($1-,%i.avconv,32))) == $false) {
  71.       inc %j.avconv
  72.       iecho $hc(WARNING!) $hc($gettok($1-,%i.avconv,32)) does not exist, yet addon is still installed!
  73.     }
  74.     else {
  75.       txt2cc $readini -n $adn($gettok($1-,%i.avconv,32)) addon aver
  76.       set %tmp.avconv %tmp.avconv $result
  77.     }
  78.     goto start
  79.   }
  80.   if (%j.avconv) iecho Please replace the .ad2 file(s) to get rid of this error message and allow you to uninstall the addon.
  81.   return %tmp.avconv
  82. }
  83. b return  $+ $iif($1 != $null,$1-) $+ $iif($1 != $null,)
  84. backspace {
  85.   if ($1- == $null) return
  86.   var %a, %b, %c
  87.   bunset &backspace.y &backspace.z
  88.   bset -t &backspace.z 1 $1-
  89.   set %a 0
  90.   set %b 0
  91.   :start
  92.   inc %a
  93.   inc %b
  94.   if ($bvar(&backspace.z,%a) != $null) {
  95.     set %c $ifmatch
  96.     if (%c == 8) {
  97.       bset &backspace.y %b 0
  98.       dec %b 2
  99.       if (%b < 0) set %b 0
  100.       goto start
  101.     }
  102.     bset &backspace.y %b %c
  103.     goto start
  104.   }
  105.   return $bvar(&backspace.y,1-).text
  106. }
  107. botpass {
  108.   if ($readini -n users.ini $1 botpass != $null) crypt 1 $lower($1) $ifmatch
  109.   if ($result) return $result
  110. }
  111. brkt return $b([) $+ $hc($1-) $+ $b(])
  112. browser return $readini -n mirc.ini Files Browser
  113. ca {
  114.   if (H isin $1) return HERE
  115.   else return AWAY
  116. }
  117. caps return $ascode(65,90,$1-)
  118. cc2txt return $replace($1-,,<c>,,<b>,,<u>,,<o>,,<r>)
  119. cent2 return $str( ,$div($sub($1,$len($2-)),2)) $+ $2- $+ $str( ,$div($sub($1,$len($2-)),2))
  120. cent return $str( ,$div($sub($1,$len($2-)),2)) $+ $2- $+ $str( ,$pls($div($sub($1,$len($2-)),2),1))
  121. center {
  122.   if ($len($strip($2-)) >= $1) return $2-
  123.   else {
  124.     if ($mod($sub($1,$len($strip($2-))),2) == 0) return $str( ,$int($div($sub($1,$len($strip($2-))),2))) $+ $2- $+ $str( ,$int($div($sub($1,$len($strip($2-))),2)))
  125.     else return $str( ,$int($div($sub($1,$len($strip($2-))),2))) $+ $2- $+ $str( ,$pls($int($div($sub($1,$len($strip($2-))),2)),1))
  126.   }
  127. }
  128. cflags return $readini -n users.ini $1 $2
  129. chkflag {
  130.   if ($3 isincs $flags($1)) return $true
  131.   elseif ($isvalidchan($usrchans($1),$2) && ($3 isincs $cflags($1,$2))) return $true
  132.   elseif ($2 == *) {
  133.     set %i.chkflag 0
  134.     :start
  135.     inc %i.chkflag
  136.     if ($gettok($usrchans($1),%i.chkflag,44)) {
  137.       if ($3 isincs $cflags($1,$gettok($usrchans($1),%i.chkflag,44))) return $true
  138.       goto start
  139.     }
  140.     else return $false
  141.   }
  142.   else return $false
  143. }
  144. chkop {
  145.   set %i.chkop 0
  146.   :start
  147.   inc %i.chkop
  148.   if ($chan(%i.chkop) == $null) return $false
  149.   elseif ($me isop $chan(%i.chkop)) && ($1 !ison $chan(%i.chkop)) return $true
  150.   else goto start
  151. }
  152. chlist {
  153.   unset %tmp.chlist
  154.   set %i.chlist 0
  155.   :start
  156.   inc %i.chlist
  157.   if ($gettok($1,%i.chlist,44) != $null) {
  158.     if (%i.chlist == 1) set %tmp.chlist $gettok($1,1,44)
  159.     else {
  160.       if (%i.chlist == $gettok($1,0,44)) {
  161.         if (%i.chlist == 2) set %tmp.chlist %tmp.chlist and $gettok($1,%i.chlist,44)
  162.         else set %tmp.chlist %tmp.chlist $+ , and $gettok($1,%i.chlist,44)
  163.       }
  164.       else set %tmp.chlist %tmp.chlist $+ , $gettok($1,%i.chlist,44)
  165.     }
  166.     goto start
  167.   }
  168.   return %tmp.chlist
  169. }
  170. chn-key return $readini -n ircndata.ini channel-keys $1
  171. c return 
  172. clop {
  173.   if ($1 isop $2) return @ $+ $1
  174.   elseif ($1 ishelp $2) return % $+ $1
  175.   elseif ($1 isvo $2) return + $+ $1
  176.   else return $1
  177. }
  178. clop2 {
  179.   if ($me isop $1) return @ $+ $1
  180.   elseif ($me ishelp $1) return % $+ $1
  181.   elseif ($me isvo $1) return + $+ $1
  182.   else return $1
  183. }
  184. com.channels {
  185.   unset %tmp.com.channels
  186.   set %i.com.channels 0
  187.   :start
  188.   inc %i.com.channels
  189.   if ($comchan($1,%i.com.channels)) {
  190.     set %tmp.com.channels $addtok(%tmp.com.channels,$comchan($1,%i.com.channels),44)
  191.     goto start
  192.   }
  193.   return %tmp.com.channels
  194. }
  195. com.opchannels {
  196.   unset %tmp.com.opchannels
  197.   set %i.com.opchannels 0
  198.   :start
  199.   inc %i.com.opchannels
  200.   if ($comchan($1,%i.com.opchannels)) {
  201.     if ($me isop $comchan($1,%i.com.opchannels)) set %tmp.com.opchannels $addtok(%tmp.com.opchannels,$comchan($1,%i.com.opchannels),44)
  202.     goto start
  203.   }
  204.   return %tmp.com.opchannels
  205. }
  206. cnum if ($len($1) < 2) return 0 $+ $1 | else return $1
  207. colnum return  $+ $cnum($colour($1))
  208. cpms {
  209.   if (($1 == $null) || (($1 isnum) && ($2 == $null))) return .
  210.   else return : $1-
  211. }
  212. crypt {
  213.   if ($3- == $null) return
  214.   bunset &crypt.y &crypt.z
  215.   var %a, %z
  216.   set %z $2
  217.   set %a $len($3-)
  218.   while (%a > 0) {
  219.     set %z $hash(%z,32)
  220.     bset -t &crypt.z $calc($bvar(&crypt.z,0) + 1) %z
  221.     dec %a $len(%z)
  222.   }
  223.   bset -t &crypt.z $calc($bvar(&crypt.z,0) + 1) %z
  224.   bset -t &crypt.y 1 $3-
  225.   set %a 1
  226.   while ($bvar(&crypt.y,%a) != $null) {
  227.     bset &crypt.y %a $calc($ifmatch - ($1 * 2 - 1) * ($bvar(&crypt.z,%a) - 48))
  228.     inc %a
  229.   }
  230.   return $bvar(&crypt.y,1-).text
  231. }
  232. current if ($1 != $null) return (current $1 $+ )
  233. dd return %dir $+ \docs\ $+ $1-
  234. de-op {
  235.   if (($1 isop $2) && ($3 == sb)) return +b-o $address($1,4) $1
  236.   elseif ($1 isop $2) return +b-o $address($1,%kbmask) $1
  237.   elseif ($3 == sb) return +b $address($1,4)
  238.   else return +b $address($1,%kbmask)
  239. }
  240. d.g {
  241.   if (($get($1).cps == n/a) || ($get($1).cps == 0)) return n/a
  242.   else return $2
  243. }
  244. div {
  245.   if (($1 isnum) && ($2 isnum)) return $calc($1 / $2)
  246.   elseif (($1 isnum) && ($2 == $null)) return $1
  247.   elseif (($1 == $null) && ($2 isnum)) return 0
  248.   elseif (($1 == $null) && ($2 == $null)) return
  249.   else iecho DIV Error, $1 and $2 are not numbers!
  250. }
  251. d.s {
  252.   if ($1 == n/a) return 0
  253.   else return $1
  254. }
  255. e-mail if (%em == on) return [email: $+ $1 $+ ]
  256. ed return %dir $+ \email\ $+ $1
  257. fix return $2- $+ $str( ,$sub($1,$len($strip($2-))))
  258. fix2 return $2- $+ $str(á,$sub($1,$len($strip($2-))))
  259. fix.ver {
  260.   if (($1) && ($1- !isin %ver)) return %ver + $1-
  261.   else return %ver
  262. }
  263. flags return $readini -n users.ini $1 flags
  264. form {
  265.   if ((%sthemes == on) && (%formats)) {
  266.     if ($2) return $readini %formats $1 $2
  267.     else return $readini %formats $1 use
  268.   }
  269. }
  270. full-date return $asc-time($ctime)
  271. getadd return $gettok($1,2,33)
  272. getcenter return $int($sub($div($window(-3).w,2),$div($1,2))) $int($sub($div($window(-3).h,2),$div($2,2))) $1 $2
  273. getdate {
  274.   set %tmp.getdate dddd, mmmm d h:nn tt yyyy
  275.   return $replace($asctime(%tmp.getdate),pm,PM,am,AM)
  276. }
  277. getline return $read -s [ $+ [ $2 ] ] $1
  278. getleft return $left($1-,-1)
  279. getright return $right($1-,-1)
  280. getnick return $nocolon($gettok($1,1,33))
  281. gettz return $asctime(zz)
  282. gone {
  283.   if ($away) return $rsc($duration($sub($ctime,%awaytime)))
  284.   else return 0s
  285. }
  286. hc return  $+ %c2 $+ $iif($1 != $null,$1-) $+ $iif($1 != $null,)
  287. hlag {
  288.   if (%lag isnum) return [l: $+ %lag $+ ]
  289.   else return
  290. }
  291. hstmask {
  292.   if ($2 == $null) return $readini -n users.ini $1 hostmask
  293.   else return $gettok( [ $readini -n users.ini $1 hostmask ] ,$2,32)
  294. }
  295. iduration {
  296.   if ($1 !isnum) {
  297.     iecho IDURATION: $1 is not a number!
  298.     return
  299.   }
  300.   if ($1 < 60) return $1 second $+ $plural($1)
  301.   elseif ($1 < 3600) return $int($div($1,60)) minute $+ $plural($int($div($1,60))) $+ , $mod($1,60) second $+ $plural($mod($1,60))
  302.   else return $duration($round($1,0))
  303. }
  304. inscma {
  305.   if ($len($1) < 4) return $1
  306.   elseif ($len($1) < 7) return $left($1,$sub($len($1),3)) $+ , $+ $right($1,3)
  307.   elseif ($len($1) < 10) {
  308.     set %tmp1 $right($1,6)
  309.     set %tmp2 $left(%tmp1,3)
  310.     return $left($1,$sub($len($1),6)) $+ , $+ %tmp2 $+ , $+ $right($1,3)
  311.   }
  312.   else {
  313.     set %tmp1 $right($1,9)
  314.     set %tmp2 $mid(%tmp1,4,3)
  315.     return $left($1,$sub($len($1),9)) $+ , $+ $left(%tmp1,3) $+ , $+ %tmp2 $+ , $+ $right($1,3)
  316.   }
  317. }
  318. infoline {
  319.   if ($2) return $readini -n users.ini $1 $addtok(infoline,$2,46)
  320.   else return $readini -n users.ini $1 infoline
  321. }
  322. iscloaked {
  323.   if ($chkflag($usrh($1),$null,m)) return $false
  324.   if (% [ $+ [ $addtok(cloak,$2,46) ] ] == on) return $true
  325.   return $false
  326. }
  327. isopped {
  328.   set %i.isopped 0
  329.   :start
  330.   inc %i.isopped
  331.   if ($chan(%i.isopped)) {
  332.     if ($1 isop $chan(%i.isopped)) return $true
  333.     goto start
  334.   }
  335.   return $false
  336. }
  337. ispwctcp1 if ($istok($addtok(CHAN OP INVITE INFO IDENT NOTES,%pwctcp1,32),$1,32)) return $true
  338. ispwctcp2 if ($istok($addtok(PASS,%pwctcp2,32),$1,32)) return $true
  339. isvalidchan if (($findtok($1,$2,1,44)) || ($1 == all)) return $true
  340. kps return $round($div($1,1024),1)
  341. lfix return $str( ,$sub($1,$len($strip($2-)))) $+ $2-
  342. lfix2 return $str(á,$sub($1,$len($strip($2-)))) $+ $2-
  343. middir return $mididir $+ $1-
  344. lgdir return $logdir $+ $1-
  345. mail.add return $readini -n ircndata.ini $1 email
  346. mail.ip return $readini -n ircndata.ini $1 mailip
  347. mail.name return $readini -n ircndata.ini $1 username
  348. mail.pass {
  349.   crypt 1 $lower($1) $readini -n ircndata.ini $1 emailpass
  350.   return $result
  351. }
  352. mflag return $gettok($mirc.ini($1,$2),$3,44)
  353. mirc.ini return $readini -n $mircini $1 $2
  354. mp3dir return %dir $+ \mp3\ $+ $1
  355. mpy {
  356.   if (($1 isnum) && ($2 isnum)) return $calc($1 * $2)
  357.   elseif ((($1 isnum) && ($2 == $null)) || (($1 == $null) && ($2 isnum))) return 0
  358.   elseif (($1 == $null) && ($2 == $null)) return
  359.   else iecho MPY Error, $1 and $2 are not numbers!
  360. }
  361. mychans return $com.channels($me)
  362. nc {
  363.   if ((%nc == on) && ($1)) {
  364.     if ($2) {
  365.       if ($remove($1,%nch) ison $2) return $ialchan( [ [ $remove($1,%nch) ] $+ ] !*@*,$2,1).nick
  366.       elseif ($ialchan( [ [ $remove($1,%nch) ] $+ ] *!*@*,$2,1).nick) return $ialchan( [ [ $remove($1,%nch) ] $+ ] *!*@*,$2,1).nick
  367.       elseif ($ialchan(* [ $+ [ $remove($1,%nch) ] $+ ] *!*@*,$2,1).nick) return $ialchan(* [ $+ [ $remove($1,%nch) ] $+ ] *!*@*,$2,1).nick
  368.     }
  369.     else { 
  370.       if ($1 ison $active) return $1
  371.       elseif ($ialchan( [ [ $1 ] $+ ] *!*@*,$active,1).nick) return $ialchan( [ [ $1 ] $+ ] *!*@*,$active,1).nick
  372.       elseif ($ialchan(* [ $+ [ $1 ] $+ ] *!*@*,$active,1).nick) return $ialchan(* [ $+ [ $1 ] $+ ] *!*@*,$active,1).nick
  373.       else return $1
  374.     }
  375.   }
  376.   else return $1
  377. }
  378. ncomp {
  379.   if ((%ncstyle == random) && ($form(nickcomp,styles))) return $readini %formats nickcomp $gettok($form(nickcomp,styles),$rand(1,$gettok($form(nickcomp,styles),0,44)),44)
  380.   elseif ($form(nickcomp,%ncstyle)) return $readini %formats nickcomp %ncstyle
  381.   else return %nlb $+ $1 $+ %nrb
  382. }
  383. nd return %dir $+ \network\ $+ %irc.network $+ . $+ $1
  384. nll {
  385.   if ($1 != $null) return $1
  386.   else return 
  387. }
  388. nocolon {
  389.   if ($left($1,1) == :) return $right($1-,$sub($len($1-),1))
  390.   else return $1-
  391. }
  392. ns.rnick return $readini -n $tp(wholeft.txt) $1 n $+ [ $2 ]
  393. ns.rnick2 return $readini -n $tp(wholeft.txt) $1 n $+ [ $2 ]
  394. ns.rserv return $readini -n $tp(wholeft.txt) splitservers n $+ [ $1 ]
  395. nv return [w $+ $os $+ /u $+ %uses $+ /mb $+ $bits $+ v $+ $gettok($version,1,46) $+  $+ $gettok($version,2,46) $+ ]
  396. o return 
  397. oc if ($1 == on) return $ab($2)
  398. ocenter {
  399.   if ($len($strip($2-)) >= $1) return $2-
  400.   else {
  401.     if ($mod($sub($1,$len($strip($2-))),2) == 0) return $str( ,$int($div($sub($1,$len($strip($2-))),2))) $+ $2- $+ $str( ,$int($div($sub($1,$len($strip($2-))),2)))
  402.     else return $str( ,$int($div($sub($1,$len($strip($2-))),2))) $+ $2- $+ $str( ,$pls($int($div($sub($1,$len($strip($2-))),2)),1))
  403.   }
  404. }
  405. pages return $iif($isfile($td(page.txt)),$lines($td(page.txt)),0)
  406. paren if ($1) return ( $+ $1- $+ )
  407. password {
  408.   if ($readini -n users.ini $1 password != $null) crypt 1 $lower($1) $ifmatch
  409.   if ($result) return $result
  410. }
  411. pc return  $+ $colour(Normal) $+ $iif($1 != $null,$1-) $+ $iif($1 != $null,)
  412. pls {
  413.   if (($1 isnum) && ($2 isnum)) return $calc($1 + $2)
  414.   elseif (($1 isnum) && ($2 == $null)) return $1
  415.   elseif (($1 == $null) && ($2 isnum)) return $2
  416.   elseif (($1 == $null) && ($2 == $null)) return
  417.   else iecho PLS Error, $1 and $2 are not numbers!
  418. }
  419. plural if ($1 != 1) return s
  420. pst {
  421.   if (%userstatus == on) {
  422.     if ($1 isop $2) {
  423.       if ($chkflag($usr($1),$2,o)) return $hc(@) $+ $1
  424.       elseif ($me isop $2) return $ac(@) $+ $1
  425.       else return $sc(@) $+ $1
  426.     } 
  427.     elseif ($1 isvo $2) {
  428.       if (($chkflag($usr($1),$2,v)) || ($chkflag($usr($1),$2,o))) return $hc(+) $+ $1
  429.       else return $sc(+) $+ $1
  430.     }
  431.     elseif ($usr($1)) return $hc(!) $+ $1
  432.     else return $sc(!) $+ $1
  433.   }
  434.   else return $1
  435. }
  436. pst2 {
  437.   if (%userstatus == on) {
  438.     if ($1 isop $2) {
  439.       if ($chkflag($usr($1),$2,o)) return $hc(@)
  440.       elseif ($me isop $2) return $ac(@)
  441.       else return $sc(@)
  442.     } 
  443.     elseif ($1 isvo $2) {
  444.       if (($chkflag($usr($1),$2,v)) || ($chkflag($usr($1),$2,o))) return $hc(+)
  445.       else return $sc(+)
  446.     }
  447.     elseif ($usr($1)) return $hc(!)
  448.     else return $sc(!)
  449.   }
  450. }
  451. pub return %dir $+ \pub\ $+ $1
  452. pwr {
  453.   if (($1 isnum) && ($2 isnum)) return $calc($1 ^ $2)
  454.   elseif (($1 isnum) && ($2 == $null)) return 1
  455.   elseif (($1 == $null) && ($2 isnum)) return 0
  456.   elseif (($1 == $null) && ($2 == $null)) return
  457.   else iecho PWR Error, $1 and $2 are not numbers!
  458. }
  459. queue1 {
  460.   if ($ddename == $null) ddeset
  461.   if ($ddename == ircN) return $tp(queue1a.txt)
  462.   else return $tp($addtok($addtok(queue,$right($ddename,-4),0),a.txt,0))
  463. }
  464. queue2 {
  465.   if ($ddename == $null) ddeset
  466.   if ($ddename == ircN) return $tp(queue1b.txt)
  467.   else return $tp($addtok($addtok(queue,$right($ddename,-4),0),b.txt,0))
  468. }
  469. r return  $+ $iif($1 != $null,$1-) $+ $iif($1 != $null,)
  470. rb return $remove($1-,[,])
  471. rbrk if ($1 != $null) return ( $+ $sc($1-) $+ )
  472. rndstr {
  473.   unset %tmp.rndstr
  474.   set %i.rndstr 0
  475.   :loop
  476.   inc %i.rndstr
  477.   if (%i.rndstr <= $1) {
  478.     set %j.rndstr $rand(0,2)
  479.     if (%j.rndstr == 0) set %tmp.rndstr %tmp.rndstr $+ $rand(0,9)
  480.     elseif (%j.rndstr == 1) set %tmp.rndstr %tmp.rndstr $+ $rand(a,z)
  481.     elseif (%j.rndstr == 2) set %tmp.rndstr %tmp.rndstr $+ $rand(A,Z)
  482.     goto loop
  483.   }
  484.   return %tmp.rndstr
  485. }
  486. root return %dir $+ \ $+ $1
  487. rot {
  488.   if (($1 isnum) && ($2 isnum) && ($2 != 0)) return $calc($1 ^ (1 / $2))
  489.   elseif (($1 isnum) && ($2 == $null)) return
  490.   elseif (($1 == $null) && ($2 isnum)) return 0
  491.   elseif (($1 == $null) && ($2 == $null)) return
  492.   else iecho ROT Error, $1 and $2 are not numbers!
  493. }
  494. rrpt return $round($div($1,1000),3)
  495. rsc return $remove($rsc2($1-),$chr(32))
  496. rsc2 return $remove($1-,ecs,ins,rs,ays,ks,ec,in,r,ay,k)
  497. sc return  $+ %c3 $+ $iif($1 != $null,$1-) $+ $iif($1 != $null,)
  498. scr.name return $readini -n $tp(temp.txt) $1 name
  499. scr.version return $readini -n $tp(temp.txt) $1 version
  500. scr.author return $readini -n $tp(temp.txt) $1 author
  501. scr.email return $readini -n $tp(temp.txt) $1 email
  502. scr.url return $readini -n $tp(temp.txt) $1 url
  503. sd if ($isvalidchan($banchans($ulist($address($1,5),20,1)),$2)) return $true
  504. sqr {
  505.   if ($1 isnum) return $calc($1 ^ 0.5)
  506.   elseif ($1 == $null) return
  507.   else iecho SQR Error, $1 is not a number!
  508. }
  509. sub {
  510.   if (($1 isnum) && ($2 isnum)) return $calc($1 - $2)
  511.   elseif (($1 isnum) && ($2 == $null)) return $1
  512.   elseif (($1 == $null) && ($2 isnum)) return $calc(0 - $2)
  513.   elseif (($1 == $null) && ($2 == $null)) return
  514.   else iecho SUB Error, $1 and $2 are not numbers!
  515. }
  516. sum {
  517.   set %tmp.sum 0
  518.   set %i.sum 0
  519.   :loop
  520.   inc %i.sum
  521.   if ($gettok($1-,%i.sum,32)) {
  522.     set %tmp.sum $pls(%tmp.sum,$gettok($1-,%i.sum,32))
  523.     goto loop
  524.   }
  525.   return %tmp.sum
  526. }
  527. swlc return $window($1).x $window($1).y $window($1).w $window($1).h
  528. tchan {
  529.   if ($active ischan) return $ab($active) [o: $+ $opnick($active,0) v: $+ $vnick($active,0) n: $+ $rnick($active,0) t: $+ $nick($active,0) $+ ]
  530.   else return [idle: $+ $rsc($duration($idle)) $+ ]
  531. }
  532. td return %dir $+ \text\ $+ $1
  533. tflags {
  534.   unset %tmp.tflags
  535.   if (%partyline == on) set %tmp.tflags %tmp.tflags $+ p
  536.   if (%rcontrol == on) set %tmp.tflags %tmp.tflags $+ r
  537.   if (%tmp.tflags != $null) return telnet: $+ %tmp.tflags
  538.   else return telnet
  539. }
  540. themedir return %dir $+ \themes\ $+ $1
  541. themeld return $read -nl $+ $1 $tp(themeld.txt)
  542. themefn return $iif(%themefullname,%themefullname,%themename)
  543. themevar return %theme. [ $+ [ $1 ] ]
  544. togglec return $iif($1 == $2,&*,_)
  545. toggled return $iif($1 == on,&*,_)
  546. toggled2 return $iif($1 == off,_,&*)
  547. toggler return $iif($1 == on,off,on)
  548. tokmatch {
  549.   set %i.tokmatch 0
  550.   :start
  551.   inc %i.tokmatch
  552.   if ($gettok($1,%i.tokmatch,$3) != $null) {
  553.     if ($gettok($1,%i.tokmatch,$3) iswm $2) return %i.tokmatch
  554.     else goto start
  555.   }
  556. }
  557. tp return %dir $+ \temp\ $+ $1
  558. trncte return $mod($1,$2)
  559. mod {
  560.   if (($1 isnum) && ($2 isnum)) return $calc($1 % $2)
  561.   elseif (($1 isnum) && ($2 == $null)) return $calc($1 % 0)
  562.   elseif (($1 == $null) && ($2 isnum)) return $calc(0 % $2)
  563.   elseif (($1 == $null) && ($2 == $null)) return
  564.   else iecho MOD Error, $1 and $2 are not numbers!
  565. }
  566. txt2cc return $replace($1-,<c>,,<b>,,<u>,,<o>,,<r>,)
  567. u return  $+ $iif($1 != $null,$1-) $+ $iif($1 != $null,)
  568. uin if (%showuin == on) return [UIN: $+ $1 $+ ]
  569. ulcolor {
  570.   if ($3 == 40) {
  571.     if ($chkflag($usr($1),$2,k)) return %cn1
  572.     elseif ($chkflag($usr($1),$null,n)) return %cn8
  573.     elseif ($chkflag($usr($1),$null,m)) return %cn7
  574.     elseif ($chkflag($usr($1),$null,b)) return %cn6
  575.     elseif ($chkflag($usr($1),$2,o)) return %cn5
  576.     elseif ($chkflag($usr($1),$2,v)) return %cn4
  577.     elseif ($chkflag($usr($1),$2,f)) return %cn3
  578.     else return %cn2
  579.   }
  580.   elseif (($3 == 20) && ($sd($1,$2))) return %cn1
  581.   else return $colour(Listbox Text)
  582. }
  583. usr return $readini -n users.ini Users $ulist($address($1,5),40,1)
  584. usrh return $readini -n users.ini Users $ulist($1,40,1)
  585. usrl {
  586.   if ($usr($1)) return $usr($1)
  587.   elseif ($usrhost($1)) return $1
  588. }
  589. usrchans return $readini -n users.ini $1 channels
  590. banchans return $readini -n bans.ini $1 channels
  591. usrhost return $readini -n users.ini $1 hostmask
  592. vl return $chr(124)
  593. wavdir return $wavedir $+ $1-
  594. wrap {
  595.   if (($right($mid($3-,$1,$2),1) == $chr(32)) || ($right($mid($3-,$1,$pls($2,1)),1) == $chr(32)) || ($pls($1,$2) > $len($3-))) {
  596.     set %wrap.pos $2
  597.     return $replace($mid($3-,$1,$2),á, )
  598.   }
  599.   set %wrap.text $mid($3-,$1,$2)
  600.   set %wrap.text2 %wrap.text
  601.   set %wrap.pos 0
  602.   if ($chr(32) isin %wrap.text) {
  603.     :sploop
  604.     set %wrap.pos $pls(%wrap.pos,$pos(%wrap.text2,$chr(32)))
  605.     set %wrap.text2 $mid(%wrap.text2,$pls($pos(%wrap.text2,$chr(32)),1),$sub($len(%wrap.text2),$pos(%wrap.text2,$chr(32))))
  606.     if ($pos(%wrap.text2,$chr(32)) > 1) goto sploop
  607.   }
  608.   elseif (á isin %wrap.text) {
  609.     :chloop
  610.     set %wrap.pos $pls(%wrap.pos,$pos(%wrap.text2,á))
  611.     set %wrap.text2 $mid(%wrap.text2,$pls($pos(%wrap.text2,á),1),$sub($len(%wrap.text2),$pos(%wrap.text2,á)))
  612.     if ($pos(%wrap.text2,á) > 1) goto chloop
  613.   }
  614.   else {
  615.     unset %wrap.text2
  616.     set %wrap.pos $2
  617.     return $replace(%wrap.text,á, )
  618.   }
  619.   unset %wrap.text2
  620.   return $replace($left(%wrap.text,%wrap.pos),á, )
  621. }
  622. wrpt {
  623.   if ($len($1) < 4) return 0. $+ $str(0,$sub($len($1),1)) $+ $1 $+ s
  624.   elseif ($mid($1,1,$sub($len($1),3)) < 60) return $mid($1,1,$sub($len($1),3)) $+ . $+ $right($1,3) $+ s
  625.   else return $rsc($duration($mid($1,1,$sub($len($1),3))))
  626. }
  627.